<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@taglib uri="/WEB-INF/el.tld" prefix="el"%>
<%@taglib uri="/WEB-INF/fn.tld" prefix="fn"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title></title>
		<c:import url="/includes/css_inc.jsp"/>
		<c:import url="/includes/js_inc.jsp"/>
		<script>
		$(function(){
			$("#btnBack").button({
		        icons: {
		      	  primary: "ui-icon-arrowreturnthick-1-w"
				}
			}).click(function(){
				$("#job").val("back");
				$("#saveForm").submit();
			});
			$("#btnPrint").button({
	            icons: {
	                primary: "ui-icon-print"
	            }
			}).click(function(){ 
				window.location='${pageContext.request.contextPath}/acc6?app=ACC60303&job=print&docNo='+$("#docNo").val()+'&budgetYear='+$("#budgetYear").val()+'&provinceId='+$("#province").val();
			});
			$("#btnPrint2").button({
	            icons: {
	                primary: "ui-icon-print"
	            }
			}).click(function(){
				window.location='${pageContext.request.contextPath}/acc6?app=ACC60303&job=print2&docNo='+$("#docNo").val()+'&budgetYear='+$("#budgetYear").val()+'&provinceId='+$("#province").val();
			});
		});
		</script>
	</head>
	<body>
		<c:import url="/apps/msg.jsp"/>
		<form class="acc67-form" name="saveForm" id="saveForm" action="${pageContext.request.contextPath}/acc6" method="post">
		<input type="hidden" name="app" id="app" value="ACC60303"/>
		<input type="hidden" name="job" id="job" value="${job}"/>
		<input type="hidden" name="docNo" id="docNo" value="${docNo}"/>
		<table width="100%" class="ui-widget ui-widget-content" border="0">
			<tr>
				<th align="left" class="acc67-header ui-widget-header" colspan="2"><b>${screenCode.ACC60303}</b></th>
			</tr>
			<tr>
				<td class="bold" width="15%">เลขที่เอกสาร : </td>
				<td>${docNo}</td>
			</tr>
			<tr>
				<td class="bold">จังหวัด : </td>
				<td>${provinceName}</td>
				<td><input type="hidden" name="provinceId" id="provinceId" value="${expenseBean.provinceId}"></td>
			</tr>
			</tr>
			<tr>
				<td class="bold">ปีงบประมาณ : </td>
				<td>${expenseBean.budgetYear}</td>
				<td><input type="hidden" name="budgetYear" id="budgetYear" value="${expenseBean.budgetYear}"></td>
			</tr>
			<tr>
				<td class="bold">วันที่จ่าย : </td>
				<td>${el:dateTh(expenseBean.expenseDate)}</td>
			</tr>
			<tr>
				<td class="bold">ชื่อการจ่าย : </td>
				<td>${expenseBean.expenseSubject}</td>
			</tr>
			<tr>
				<td class="bold" valign="top">คำอธิบายการจ่าย : </td>
				<td>${expenseBean.expenseDesc}</td>
			</tr> 
			<tr>
				<td colspan="2">
				<fieldset>
					<legend> รายละเอียดการจ่าย </legend>
					<table width="100%" class="ui-widget ui-widget-content">
						<tr>
							<td class="bold" width="20%">เอกสารอ้างอิง : </td>
							<td>${refNo}</td>
							<td class="bold" width="20%">กองทุนย่อยเฉพาะด้าน : </td>
							<td>${allocateName}</td>
						</tr>
						<tr>
							<td class="bold">หมวดการจ่าย : </td>
							<td>${categoryName}</td>
							<td class="bold">ชื่อผู้รับผิดชอบ : </td>
							<td>${responsibleName}</td>
						</tr>
						<c:if test="${!empty listExpenseTransfer}">
							<tr>
								<td colspan="4">
									<table width="100%" class="acc67-grid ui-widget ui-widget-content">
										<tr>
											<th align="center" class="ui-state-default">สสอ.</th>
											<th align="center" class="ui-state-default" width="10%">จำนวนเงิน</th>
											<th align="center" class="ui-state-default" width="20%">ชื่อโครงการ/คำอธิบาย</th>
										</tr>
										<c:forEach items="${listExpenseTransfer}" var="data" varStatus="x">
											<c:set var="reasonDesc" value="${el:getReasonDesc(data.transactionTimestamp)}" />
											<c:if test="${reasonDesc == '00:SUCCESS'}">
												<tr class="grid-tr-${x.count % 2}">
											</c:if>
											<c:if test="${reasonDesc != '00:SUCCESS'}">
												<tr style="background-color: red;" title="${reasonDesc}">
											</c:if>
												<td align="left"><span title="${data.venderName}">${data.venderName}</span></td>
												<td align="right"><fmt:formatNumber pattern="#,##0.00" value="${data.transferAmount}" /></td>
												<td align="center">${data.transferDesc}</td>
											</tr>
										</c:forEach>
									</table>
								</td>
							</tr>
						</c:if>
					</table>
				</fieldset>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<c:if test="${expenseBean.expenseStatus == 'A'}">
						<button type="button" name="btnPrint" id="btnPrint" class="acc67-button">พิมพ์หนังสือขออนุมัติทำการโอนเงิน </button>
						<button type="button" name="btnPrint2" id="btnPrint2" class="acc67-button">หนังสือแจ้งโอน</button>
					</c:if>
					<button type="button" name="btnBack" id="btnBack" class="acc67-button">ย้อนกลับ</button>
				</td>
			</tr>
		</table>
		</form>
	</body>
</html>